package com.sunsys.hbase.htable.example;

import java.io.IOException;

import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.HTablePool;

public class HtableInstanceFromPoolExample {

	public HtableInstanceFromPoolExample() {
	}
	
	public static void main(String []args) throws IOException {
		
		/* create HTablePool (like connection pool) */
		HTablePool hTablePool = new HTablePool();
		/* get HTable instance from pool */
		HTableInterface hTableInterface = hTablePool.getTable("users");
		if(hTableInterface != null) {
			System.out.println("Got HTable instance from pool");
		}
		
		/* close the HTable instance */
		hTableInterface.close();
		/* close the HTablePool */
		hTablePool.close();
		
		System.out.println("Thanks for using");
	}
}
